package factory.method.idcard;

import factory.method.framework.Factory;
import factory.method.framework.Product;

import java.util.HashMap;
import java.util.Map;

public class IdCardFactory extends Factory {
    private final Map<Integer, String> owners = new HashMap<>();

    @Override
    protected void registerProduct(Product p) {
        IdCard idCard = ((IdCard) p);
        owners.put(idCard.getCode(), idCard.getOwner());
    }

    @Override
    protected Product createProduct(String owner, int code) {
        return new IdCard(owner, code);
    }
}
